@if (!_isClosed) {
    <Alert Class="@CssClass" Color="@Color" Margin="Margin.Is3.OnY" Visible="true">
        <AlertMessage>@Title</AlertMessage>
        <AlertDescription>@ChildContent</AlertDescription>
        <CloseButton Clicked="Close"/>
    </Alert>
}

@code {
    private bool _isClosed;

    [Parameter]
    public string CssClass { get; set; } = "";
    [Parameter]
    public Color Color { get; set; } = Color.Danger;
    [Parameter]
    public string Title { get; set; } = "Error:";
    [Parameter]
    public EventCallback Dismissed { get; set; }
    [Parameter]
    public RenderFragment? ChildContent { get; set; }

    private Task Close()
    {
        _isClosed = true;
        return Dismissed.InvokeAsync(null);
    }
}
